# kill all AS7 standalone servers pkill -f ".*/java .* org.jboss.as.standalone .*" # kill all AS7 host controllers pkill -f ".*/java .* org.jboss.as.process-controller .*"
It's often useful for testing purposes to start multiple JBoss AS or EAP instances on the same box. Here's a script that starts multiple instances, each listening on a different loopback IP address (127.0.0.2, 127.0.0.3, etc.):
http://git.fedorahosted.org/cgit/rhq/rhq.git/plain/etc/scripts/jboss-as-spawn.sh
An alternative approach would be to use the JBoss AS service binding manager to start each instance with a different set of ports.
The spawn script currently does not provide a way to stop AS instances previously started via the script. Here are some commands that can be used to kill AS instances on Linux:
# kill all AS7 standalone servers pkill -f ".*/java .* org.jboss.as.standalone .*" # kill all AS7 host controllers pkill -f ".*/java .* org.jboss.as.process-controller .*"
If you are starting more than a couple instances, you'll need to increase some OS user limits, since collectively they'll consume quite a few threads and a good chunk of memory. Here's the changes I had to make in order to start 5 EAP instances on my Fedora dev box (in addition to running RHQ, Oracle, IntelliJ, etc. on the box):
* soft nproc 16000 * hard nproc 32000 * soft nofile 32000 * hard nofile 64000 * soft stack 8000 * hard stack 16000
# max user processes/threads ulimit -Su 16000 ulimit -Hu 32000 # open files ulimit -Sn 32000 ulimit -Hn 64000 # stack size (KB) ulimit -Ss 8000 ulimit -Hs 16000
Note after editing the above files, you'll need to reboot your box.
You'll also need to increase the max heap and permgen of your Agent and Server, since they will have a large number of Resources in inventory. For example, to manage 5 EAP servers, I used:
RHQ_AGENT_JAVA_OPTS="-Xms192M -Xmx384M -XX:PermSize=96M -XX:MaxPermSize=192M -XX:ThreadStackSize=128K -Djava.net.preferIPv4Stack=true"
RHQ_SERVER_JAVA_OPTS="-Xms1024M -Xmx2048M -XX:PermSize=128M -XX:MaxPermSize=256M -XX:ThreadStackSize=128K -Djava.net. preferIPv4Stack=true -Djboss.server.log.dir=${_LOG_DIR_PATH}"